﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;  

/// <summary>
/// Descripción breve de PlayerZones
/// </summary>
public class PlayerZones
{
    private int _Pk_PlayerZone;
    private string _Player_Zone_Name;
    private string _Player_Zone_Flag;    

    public int Pk_PlayerZone
    {
        get { return _Pk_PlayerZone; }
        set { _Pk_PlayerZone = value; }
    }
    public string Player_Zone_Name
    {
        get { return _Player_Zone_Name; }
        set { _Player_Zone_Name = value; }
    }
    public string Player_Zone_Flag
    {
        get { return _Player_Zone_Flag; }
        set { _Player_Zone_Flag = value; }
    }

    public PlayerZones()
    {
      
    }

    public PlayerZones(int p_Pk_PlayerZone, string p_Player_Zone_Name)
    {
        this._Pk_PlayerZone = p_Pk_PlayerZone;
        this._Player_Zone_Name = p_Player_Zone_Name;
        this._Player_Zone_Flag = "img/player_flags/b" + p_Pk_PlayerZone.ToString().Trim() + ".png"; 
    }

    public static List<PlayerZones> LoadPlayerZones(){
        try
        {
            DataTable oDataTable = DataBase.dt("SELECT Pk_PlayerZone,Player_Zone_Name FROM PlayerZones");

            List<PlayerZones> ReturnList = new List<PlayerZones>();

            foreach (DataRow iRow in oDataTable.Rows)
            {
                PlayerZones oPlayerZones = new PlayerZones(Int32.Parse(iRow["Pk_PlayerZone"].ToString()), iRow["Player_Zone_Name"].ToString());
                ReturnList.Add(oPlayerZones);
            }
            return ReturnList;
        }
        catch (Exception Ex)
        {
            throw Ex;
        }
    }
}


/// <summary>
/// Descripción breve de PlayerZones
/// </summary>
public class HighScoreMachines
{
    private int _Machine;

public int Machine
{
  get { return _Machine; }
  set { _Machine = value; }
}
private string _MachineName;

public string MachineName
{
    get { return _MachineName; }
    set { _MachineName = value; }
}


    public HighScoreMachines()
    {

    }

    public HighScoreMachines(int Machine,string MachineName)
    {
        this.Machine = Machine;
        this.MachineName = MachineName; 
       
    }

    public static List<HighScoreMachines> LoadHighScoreMachines()
    {
        try
        {
            DataTable oDataTable = DataBase.dt("SELECT MachineNumber,MachineName FROM HighScoreMachines");

            List<HighScoreMachines> ReturnList = new List<HighScoreMachines>();

            foreach (DataRow iRow in oDataTable.Rows)
            {
                HighScoreMachines oPlayerZones = new HighScoreMachines(Int32.Parse(iRow["MachineNumber"].ToString()), iRow["MachineName"].ToString());
                ReturnList.Add(oPlayerZones);
            }
            return ReturnList;
        }
        catch (Exception Ex)
        {
            throw Ex;
        }
    }
}

